/*
 * Copyright (c) 2006, 2023, webrx.cn All rights reserved.
 *
 */

package cn.webrx;

/**
 * <p>Project: jse2303 - RegExp4
 * <p>Powered by webrx On 2023-07-18 10:29:23
 * <p>描述：<p>
 *
 * @author webrx [webrx@126.com]
 * @version 1.0
 * @since 17
 */
public class RegExp4 {
    public static void main(String[] args) {
        System.out.println("ab".matches("..."));//判断是不是三个符号
        System.out.println("abc".matches("..."));//判断是不是三个符号
        System.out.println("abc".matches("^...$"));//判断是不是三个符号
        System.out.println("abcd".matches("^...$"));//判断是不是三个符号
        System.out.println("abcdefghijkln".matches(".*....*")); //判断有没有三个符号

        System.out.println("abc".matches("[a-c]{3}"));
        System.out.println("abd".matches("[a-c]{3}"));
        System.out.println("aba".matches("[a-c]{3}"));
        System.out.println("aaa".matches("[a-c]{3}"));

        //[^] 取反
        System.out.println("---".matches("[^a-c]{3}"));
        System.out.println("13014577033".matches("1[358]\\d{9}"));
        System.out.println("13014577033".matches("1[^358]\\d{9}"));

        System.out.println("".matches("6?"));
        System.out.println("6".matches("6?"));
        System.out.println("5".matches("\\d?"));
    }
}
